home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / PowerPlant / HToggleRadioButton 1.2 / HToggleRadioButton Test 68k / CToggleRadioButtonApp.cp next >
Encoding:
Text File  |  1997-06-22  |  3.5 KB  |  151 lines  |  [TEXT/CWIE]

  1. // ===========================================================================
  2. //    CToggleRadioButtonApp.cp         ©1996-1997 John C. Daub. All rights reserved.
  3. // ===========================================================================
  4. //    See "HToggleRadioButton README" for more information
  5.  
  6. #include "CToggleRadioButtonApp.h"
  7.  
  8. #include <LGrowZone.h>
  9. #include <LWindow.h>
  10. #include <PP_Messages.h>
  11. #include <PP_Resources.h>
  12. #include <UDrawingState.h>
  13. #include <UMemoryMgr.h>
  14. #include <URegistrar.h>
  15. #include <LEditField.h>
  16. #include <LGroupBox.h>
  17. #include <LStdControl.h>
  18. #include <LRadioGroup.h>
  19.  
  20. #include <LToggleButton.h>
  21. #include "HToggleRadioButton.h"
  22.  
  23.  
  24. // put declarations for resource ids (ResIDTs) here
  25.  
  26. const ResIDT    window_Sample        = 1;    // EXAMPLE
  27.  
  28.  
  29. // ===========================================================================
  30. //        • Main Program
  31. // ===========================================================================
  32.  
  33. void main(void)
  34. {
  35.                                     // Set Debugging options
  36.     SetDebugThrow_(debugAction_Alert);
  37.     SetDebugSignal_(debugAction_Alert);
  38.  
  39.     InitializeHeap(3);                // Initialize Memory Manager
  40.                                     // Parameter is number of Master Pointer
  41.                                     //   blocks to allocate
  42.     
  43.                                     // Initialize standard Toolbox managers
  44.     UQDGlobals::InitializeToolbox(&qd);
  45.     
  46.     new LGrowZone(20000);            // Install a GrowZone function to catch
  47.                                     //    low memory situations.
  48.  
  49.     CToggleRadioButtonApp    theApp;            // replace this with your App type
  50.     theApp.Run();
  51. }
  52.  
  53.  
  54. // ---------------------------------------------------------------------------
  55. //        • CToggleRadioButtonApp
  56. // ---------------------------------------------------------------------------
  57. //    Constructor
  58.  
  59. CToggleRadioButtonApp::CToggleRadioButtonApp()
  60. {
  61.     RegisterClass_(HToggleRadioButton);
  62.  
  63.     RegisterClass_(LToggleButton);
  64.     RegisterClass_(LStdRadioButton);
  65.     RegisterClass_(LGroupBox);
  66.     RegisterClass_(LWindow);
  67.     RegisterClass_(LRadioGroup);
  68. }
  69.  
  70.  
  71. // ---------------------------------------------------------------------------
  72. //        • ~CToggleRadioButtonApp
  73. // ---------------------------------------------------------------------------
  74. //    Destructor
  75. //
  76.  
  77. CToggleRadioButtonApp::~CToggleRadioButtonApp()
  78. {
  79. }
  80.  
  81. // ---------------------------------------------------------------------------
  82. //        • StartUp
  83. // ---------------------------------------------------------------------------
  84.  
  85. void
  86. CToggleRadioButtonApp::StartUp()
  87. {
  88.     ObeyCommand(cmd_New, nil);
  89. }
  90.  
  91. // ---------------------------------------------------------------------------
  92. //        • ObeyCommand
  93. // ---------------------------------------------------------------------------
  94. //    Respond to commands
  95.  
  96. Boolean
  97. CToggleRadioButtonApp::ObeyCommand(
  98.     CommandT    inCommand,
  99.     void        *ioParam)
  100. {
  101.     Boolean        cmdHandled = true;
  102.  
  103.     switch (inCommand)
  104.     {
  105.                  
  106.         case cmd_New:
  107.  
  108.             LWindow        *theWindow;
  109.             theWindow = LWindow::CreateWindow(window_Sample, this);    
  110.             theWindow->Show();
  111.         break;
  112.  
  113.  
  114.  
  115.         default:
  116.             cmdHandled = LApplication::ObeyCommand(inCommand, ioParam);
  117.         break;
  118.     }
  119.     
  120.     return cmdHandled;
  121. }
  122.  
  123. // ---------------------------------------------------------------------------
  124. //        • FindCommandStatus
  125. // ---------------------------------------------------------------------------
  126. //    This function enables menu commands.
  127. //
  128.  
  129. void
  130. CToggleRadioButtonApp::FindCommandStatus(
  131.     CommandT    inCommand,
  132.     Boolean        &outEnabled,
  133.     Boolean        &outUsesMark,
  134.     Char16        &outMark,
  135.     Str255        outName)
  136. {
  137.  
  138.     switch (inCommand)
  139.     {
  140.     
  141.         case cmd_New:
  142.             outEnabled = true;
  143.         break;
  144.  
  145.         default:
  146.             LApplication::FindCommandStatus(inCommand, outEnabled,
  147.                                                 outUsesMark, outMark, outName);
  148.         break;
  149.     }
  150. }
  151.